package com.ajk.server.bkcontroller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.ajk.server.controller.access.ArgIndexForPrintLog;
import com.ajk.server.model.Suggest;
import com.ajk.server.model.query.SuggestQuery;
import com.ajk.server.model.response.ResultList;
import com.ajk.server.service.SuggestService;

@RestController
@RequestMapping("/admin/suggest")
public class AdminSuggestController {
	
	@Autowired
	SuggestService suggestService;
	
	@ArgIndexForPrintLog(indexes = { 0 })
	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public ResultList<Suggest> findMyFriends(SuggestQuery query) {
		ResultList<Suggest> resultList = new ResultList<>();
		List<Suggest> list = suggestService.findSuggestByQuery(query);
		Integer count = suggestService.countSuggestByQuery(query);
		query.setCount(count);
		
		resultList.setExt(query);
		resultList.setItemList(list);
		
		return resultList;
	}

}
